﻿<labs:PhoneLab x:Class="DaveSexton.Labs.PhoneConsoleLab"
							 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
							 xmlns:labs="clr-namespace:DaveSexton.Labs"
							 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
							 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
							 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
							 mc:Ignorable="d"
							 FontFamily="{StaticResource PhoneFontFamilyNormal}"
							 FontSize="{StaticResource PhoneFontSizeNormal}"
							 Foreground="{StaticResource PhoneForegroundBrush}"
							 d:DesignHeight="480" d:DesignWidth="480"
							 DataContext="{Binding RelativeSource={RelativeSource Self}}">
	<labs:PhoneLab.Resources>

		<labs:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
		<labs:BooleanToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter" FalseValue="Visible" TrueValue="Collapsed" />
		<labs:InverseBooleanConverter x:Key="InverseBooleanConverter" />

	</labs:PhoneLab.Resources>

	<Grid>

		<TextBox Name="InputTextBox" Margin="0 0 0 150"
						 HorizontalAlignment="Stretch" VerticalAlignment="Top"
						 Visibility="{Binding WaitingForUserInput, Converter={StaticResource BooleanToVisibilityConverter}}" />

		<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"
								Visibility="{Binding WaitingForUserInput, Converter={StaticResource InverseBooleanToVisibilityConverter}}">

			<TextBlock HorizontalAlignment="Center" Text="{Binding DisplayName}" Style="{StaticResource PhoneTextTitle2Style}" />

			<TextBlock HorizontalAlignment="Center" Text="{Binding FullCategory}" Style="{StaticResource PhoneTextTitle3Style}" />

			<ListBox ItemsSource="{Binding Experiments}"
							 SelectedItem="{Binding SelectedExperiment, Mode=TwoWay}"
							 IsEnabled="{Binding IsRunning, Converter={StaticResource InverseBooleanConverter}}"
							 Visibility="{Binding HasExperiments, Converter={StaticResource BooleanToVisibilityConverter}}"
							 Margin="0 5 0 0" MaxHeight="100">
				<ListBox.ItemTemplate>
					<DataTemplate>
						<TextBlock Text="{Binding DisplayName}" />
					</DataTemplate>
				</ListBox.ItemTemplate>
			</ListBox>

			<TextBlock HorizontalAlignment="Center" Text="{Binding Description}" Style="{StaticResource PhoneTextSmallStyle}"
								 Margin="10" TextWrapping="Wrap" />

			<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

				<Button Name="StartButton" IsEnabled="{Binding IsRunning, Converter={StaticResource InverseBooleanConverter}}"
								Height="70" Margin="10 10"
								Content="{Binding StartButtonText}" />

			</StackPanel>

		</StackPanel>

	</Grid>

</labs:PhoneLab>